The present invention is related to video coding, in particular to variable length coding of an ordered series of quantized transform coefficients of a transform of a block of image data, and in particular to amplitude coding for clustered transform coefficients which uses two-dimensional position coding of non-zero-valued and zero-valued coefficient clusters.
Two-dimensional variable length coding, referred to as 2D-VLC, has been widely used to code quantized transform coefficients. In traditional 2D-VLC, statistics are collected or assumed of events that include a run of consecutive zero-valued coefficients followed by a single non-zero amplitude coefficient that follows the run length. The ordering of the series of quantized transform coefficients is along a pre-selected path, e.g., a zig-zag path, in the two-dimensional path of the transform. Thus, in a typical implementation, a two-dimensional table consisting of the ending amplitude and the run-length of the preceding consecutive zero-valued coefficients is constructed and variable length codes, such as optimal Huffman codes or arithmetic codes, are assigned according to the assumed or measured statistics to form the 2D-VLC table for the subsequent encoding process. Shorter code lengths are used for the more likely-to-occur, e.g., more frequently occurring events.
2D-VLC is used in common transform coding methods, such as JPEG, MPEG1, MPEG2, ITU-T-261, etc., as follows. For motion video, an image is divided into blocks, e.g., 8 by 8 or 16 by 16 blocks. Each image is classified as interframe or intraframe. Interframe images are typically post motion compensation. The blocks of the image are transformed and the transform coefficients are quantized. The quantized transform coefficients are then coded along a specified path according to a 2D-VLC table. Interframe and intraframe images typically have different 2D-VLC tables. The DC component is typically separately encoded. Furthermore, the 2D-VLC table may be truncated so that the least frequently occurring events use an escape code followed by a fixed length code. A special “EOB” code is used to indicate the end of the block when all remaining coefficients are zero.
One advantage of traditional 2D-VLC is that the position of each non-zero-valued quantized coefficient and its amplitude are coded simultaneously, which generally result in shorter code lengths than using a separate code, e.g., a VLC code for each non-zero-valued coefficient and coefficient amplitude.
Because of the widespread use of image coding, many patents have been issued on different forms of VLC. U.S. Pat. No. 4,698,672 issued Oct. 6, 1987 to Wen-hsiung Chen, one of the inventors of the present invention, for example, described one form of a two-dimensional variable length coding method.
One deficiency of 2D-VLC is that every non-zero-valued coefficient needs to be accompanied by a runlength code to identify its position, in the form of the number of preceding zero-valued coefficients.
In block based transform coding, there often is a region, e.g., a low-frequency region along the ordering in which non-zero-valued coefficients tend to cluster, i.e., there are often a number of consecutive non-zero-valued coefficients along the low frequency region of the pre-determined path. Each one of a number of such consecutive non-zero-valued coefficients would require the same number of codewords representing the position and amplitude.
U.S. patent application Ser. No. 10/342,537 to inventors Chen et al., filed Jan. 15, 2003 and titled AN EXTENSION OF TWO-DIMENSIONAL VARIABLE LENGTH CODING FOR IMAGE COMPRESSION describes a method called the “Extended 2D-VLC Method” herein that includes encoding repetitions of some non-zero coefficient values. One variant of the Extended 2D-VLC method provides codes for all the possible amplitude variations of consecutive coefficients that follow a set of zero-valued coefficients. This effectively reduced the runlength to 1 for all cases. The difficulty of this approach is that there are enormous numbers of patterns that can be generated from the amplitudes of consecutive coefficients. For example, with 32 quantization levels as defined in many common video coding standards, there are in the order of 32n patterns that can be generated from n consecutive coefficients. As such, in a practical implementation, only a limited number of the most likely-to-occur non-zero amplitude values, such as 1 and 2, and a limited number of lengths of consecutive non-zero-values, such as 3 or 4 consecutive values, are regrouped for pattern matching.
Furthermore, in coding, while there may be a region where there are clusters of non-zero-valued coefficients, there is also likely to be a high frequency region where any non-zero-valued coefficients are likely to be scattered.
With this observation in mind, U.S. patent application Ser. No. 10/869,229 to inventors Chen et al., filed Jun. 15, 2004 and titled A HYBRID VARIABLE LENGTH CODING METHOD FOR LOW BIT RATE VIDEO CODING, was developed to encode the position and amplitude of quantized transform coefficients separately and takes advantage of the nature of the distribution of the transform coefficients in the low frequency and high frequency regions. The contents of U.S. patent application Ser. No. 10/869,229 are incorporated herein by reference, except any material incorporated by reference in U.S. patent application Ser. No. 10/869,229 and not explicitly incorporated by reference in the present disclosure. The methods described in the incorporated by reference parts of U.S. patent application Ser. No. 10/869,229 are each and collectively called the “Basic Hybrid VLC Method” herein.
U.S. patent application Ser. No. 10/898,654 to inventors Chen et al., filed Jul. 22, 2004 and titled AN EXTENDED HYBRID VARIABLE LENGTH CODING METHOD FOR LOW BIT RATE VIDEO CODING, was invented, and provides an alternative coding method for the high frequency region by taking advantage of the very few amplitude values in the high frequency region, especially, for example, for low bit rate and interframe applications. The contents of U.S. patent application Ser. No. 10/898,654 are incorporated herein by reference, except any material incorporated by reference in U.S. patent application Ser. No. 10/898,654 and not explicitly incorporated by reference in the present disclosure. The methods described in the incorporated by reference parts of U.S. patent application Ser. No. 10/898,654 are each and collectively called the “Extended Hybrid VLC Method” herein.
In one embodiment of the above-mentioned Basic Hybrid VLC Method, two independent types of coding schemes are introduced to code the quantized coefficients along the path. A boundary is established along the path to define two regions, e.g., a low frequency region and a high frequency region. The boundary can be made adaptive to the video depending on a number of factors such as intraframe coding or interframe coding, standard definition television (SDTV) or high definition television (HDTV), complex scene or simple scene, high bit rate coding or low bit rate coding, and so forth. In one embodiment, the encoding of the quantized coefficients in the low-frequency region includes coding the positions of consecutive non-zero-valued coefficients and the positions of consecutive zero-valued coefficients using a run-length coding method of a first type and a run-length coding method of a second type. The encoding further includes coding the amplitude values and sign of the non-zero-valued coefficients. In the high-frequency region, in one embodiment, the encoding of coefficients in the high frequency region includes encoding the positions of either no consecutive zero-valued coefficients or runs of one or more consecutive zero-valued coefficients using a run-length coding method of a third type. The encoding further includes coding the amplitude values and sign of the non-zero-valued coefficients.
In one embodiment of the above-mentioned Extended Hybrid VLC Method, a coding method is used in the second region that takes into account that almost all non-zero-valued coefficients in the high frequency region are ±1. No amplitude coding is needed to encode runs of consecutive zeroes that end in a coefficient of amplitude 1. An exception (escape) code is included to encode those rare non-zero-valued coefficients that have values other than ±1.
In the Basic Hybrid VLC Method and the Extended Hybrid VLC Method, the consecutive non-zero-valued coefficients and the consecutive zero-valued coefficients in the low frequency region are coded alternatively using two independent one-dimensional variable length coding methods, e.g., using two independent one-dimensional VLC tables. An observation was made that an improvement in coding efficiency can further be achieved by pairing the consecutive non-zero-valued coefficients and zero-valued coefficients as a pair and applying a single two-dimensional table to code the pair. With this observation, the 2-D Non-Zero/Zero Cluster Coding Method of the incorporated by reference parts of above-mentioned U.S. patent application Ser. No. 10/922,508 was introduced to improve the coding efficiency, for example for the low frequency region, and in other embodiments for more than the low frequency region.
In one embodiment of the 2-D Non-Zero/Zero Cluster Coding Method, a method includes, in a first contiguous region, identifying events that each include a run of zero-valued coefficients preceding a run of one or more non-zero-valued coefficients. The method includes for each such event, jointly encoding the run lengths of the preceding run of zero-valued coefficients and the following run of non-zero-valued coefficients with a codeword, such that for at least some events, relatively more likely-to-occur pairs of runlengths are encoded by a shorter codeword than relatively less likely-to-occur runlengths. The method further includes encoding each amplitude in the run of consecutive non-zero-valued coefficients, and encoding the signs of such coefficients. In an improved variation, each event includes a single zero-valued coefficient following the run of non-zero-valued coefficients.
In each of the 2-D Non-Zero/Zero Cluster Coding Method, the Basic Hybrid VLC Method, and the Extended Hybrid VLC Method, various variable length coding methods are introduced to encode the relative positions of the clustered or non-clustered transform coefficients. After each such encoding, a coding of the magnitude of each non-zero valued coefficient is included, as is a sign bit (+ or −).
The inventors have noticed that encoding the amplitudes takes up a significant part of the code in VLC coding of clusters of non-zero-valued coefficients.
The inventors observed that, at least in theory, an improvement in amplitude code can be achieved by introducing a single multi-dimensional code, say an n-dimensional code, n an integer greater than 1, to encode n clustered non-zero coefficients, instead of using n separate one dimensional codes. The Basic Multi-Dimensional Amplitude Coding Method of the incorporated by reference parts of above-mentioned U.S. patent application Ser. No. 10/922,507 includes such multidimensional amplitude coding.
One embodiment of the Basic Multi-Dimensional Amplitude Coding Method includes, in a first region, identifying events that each includes a run of one or more non-zero-valued coefficients, and for each such event, encoding the event with a codeword such that for at least some events, relatively more likely-to-occur events are encoded by a shorter codeword than relatively less likely-to-occur events, and for each identified event, jointly encoding a plurality of consecutive values in the run of consecutive non-zero-valued coefficients, the joint encoding according to an amplitude coding method. The method is such that relatively short codewords are formed to represent values or sequences of values that are relatively more likely-to-occur, and relatively long codewords are formed to represent values or sequences of values that are relatively less likely-to-occur. The method is applicable to encoding a region in the series where there is likely to be a cluster of non-zero-valued coefficients.
While the Basic Multi-Dimensional Amplitude Coding Method invention described in U.S. patent application Ser. No. 10/922,507 appears to improve the overall coding efficiency, it was observed that the size of the n-dimensional table used for the joint encoding can become rather large for a large “n.” As a result, in practice, the size of n has to be limited to a low number of consecutive non-zero-amplitude values, such as 1, 2 and 3 for practical implementation.
Thus there still is a need in the art for a relatively efficient method of encoding clusters of amplitudes applicable to variable length coding.